﻿namespace Okazuki.MVVM.PrismSupport.Interactivity
{
    using System.Windows;
    using Microsoft.Practices.Prism.Interactivity.InteractionRequest;

    /// <summary>
    /// NotificationのContentを保持するアクション
    /// </summary>
    public class NotificationContentHolderAction : DispatcherTriggerAction
    {
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register(
                "Value", 
                typeof(object), 
                typeof(NotificationContentHolderAction), 
                new PropertyMetadata(null));

        /// <summary>
        /// NotificationのContentを保持するプロパティ
        /// </summary>
        public object Value
        {
            get { return (object)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value); }
        }

        protected override void InvokeAction(InteractionRequestedEventArgs e)
        {
            this.Value = e.Context.Content;
        }
    }
}
